package com.kgc.cgconsumer.Controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.cgconsumer.service.PurchaseProviderSummaryFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/PurchaseOrderSummary")
@CrossOrigin
public class PurchaseProviderSummaryController {

    private Logger logger = LoggerFactory.getLogger(PurchaseProviderSummaryController.class);

    @Autowired
    private PurchaseProviderSummaryFeign purchaseProviderSummaryFeign;

    @RequestMapping("selectSummaryByPurchaseProvider")
    public ResponseMsg selectSummaryByPurchaseProvider(@RequestBody Map<String, Object> map) {
        logger.info("consumer PurchaseProviderSummaryController selectSummaryByPurchaseProvider map:{}", map);
        return purchaseProviderSummaryFeign.selectSummaryByPurchaseProvider(map);
    }

    @RequestMapping("selectSummaryByStaff")
    public ResponseMsg selectSummaryByStaff(@RequestBody Map<String, Object> map) {
        logger.info("consumer PurchaseProviderSummaryController selectSummaryByStaff map:{}", map);
        return purchaseProviderSummaryFeign.selectSummaryByStaff(map);
    }

    @RequestMapping("getPurchaseOrderDataByDate")
    public ResponseMsg getPurchaseOrderDataByDate() {
        logger.info("consumer PurchaseProviderSummaryController selectSummaryByStaff is start...");
        return purchaseProviderSummaryFeign.getPurchaseOrderDataByDate();
    }

    @RequestMapping("getPurchaseInBoundDataByTime")
    public ResponseMsg getPurchaseInBoundDataByTime() {
        logger.info("consumer PurchaseProviderSummaryController getPurchaseInBoundDataByTime is start...");
        return purchaseProviderSummaryFeign.getPurchaseInBoundDataByTime();
    }

    @RequestMapping("getPurchaseRequestDataByTime")
    public ResponseMsg getPurchaseRequestDataByTime() {
        logger.info("consumer PurchaseProviderSummaryController getPurchaseRequestDataByTime is start...");
        return purchaseProviderSummaryFeign.getPurchaseRequestDataByTime();
    }

    @RequestMapping("getPurchaseReturnDataByTime")
    public ResponseMsg getPurchaseReturnDataByTime(){
        logger.info("consumer PurchaseProviderSummaryController getPurchaseReturnDataByTime is start...");
        return purchaseProviderSummaryFeign.getPurchaseReturnDataByTime();
    }
}
